<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link href="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/4.6.1/css/bootstrap.css" rel="stylesheet">
    <style>
        .content{
            width: 400px;
            margin: 0 auto;
        }
    </style>
</head>
<body>
    <div class="content">
        <h1 style="text-align: center">用户注册</h1>
        <form method="post" novalidate>
            {% csrf_token %}
            {% for item in form %}
                {% if item.name == "code" %}
                    <div class="form-group">
                        <label for="{{ item.id_for_label }}">{{ item.label }}</label>
                        <div class="row clearfix">
                            <div class="col-md-6"> {{ item }}</div>
                            <div class="col-md-4"><input type="button" class="btn btn-secondary" value="发送验证码"></div>
                            <small  style="color: red">{{ item.errors.0 }}</small>
                        </div>

                    </div>
                {% else %}
                    <div class="form-group">
                        <label for="{{ item.id_for_label }}">{{ item.label }}</label>
                            {{ item }}
                            <small style="color: red">{{ item.errors.0 }}</small>
                     </div>
                {% endif %}
                 {% endfor %}

          <button type="submit" class="btn btn-primary">注册</button>
        </form>
    </div>
</body>
</html>